#!/bin/bash

BASEDIR=/mydata/webserver/wwwroot/furniture


BACKUPDB_LOCALDIR=${BASEDIR}/backlog
DESTDIR=$BACKUPDB_LOCALDIR/$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/

mkdir -p $BACKUPDB_LOCALDIR
mkdir -p $DESTDIR

BACKNOW_DIR=txtlog_$(date +"%Y%m%d%H%M%S")

tar zcvf ${BACKNOW_DIR}.tar.gz ${BASEDIR}/*.txt ${BASEDIR}/lib/*.txt

mv -f ${BACKNOW_DIR}.tar.gz  $DESTDIR

rm -f ${BASEDIR}/*.txt
rm -f ${BASEDIR}/lib/*.txt
